<template>
	<view class="wallet-container full box relative flex column">
		<view class="wallet-value">
			<text>￥{{ money }}</text>
		</view>
		<view class="take-btn" @click="toTakeMoney">
			<text>申请提现</text>
		</view>
	</view>
</template>

<script>
	import { mapGetters } from 'vuex'
	export default {
		computed: {
			...mapGetters(['payload']),
		},
		onShow() {
			this.initData()
		},
		methods: {
			async initData() {
				if (this.payload === -2) return this.$toast({ title: "未选择门店" }, () => {
					uni.switchTab({
						url: '/pages/index/index'
					})
				})
				this.https('/store/walletbalance', this.payload).then(resp => {
					const { data } = resp
					this.money = data || '0.00'
					console.log(this.money, 'monmey');
					this.$toast({ title: '获取余额成功', time: 2000 })
				}).catch(error => {
					this.$toast({ title: "获取余额失败", time: 2000 }, () => {
						uni.navigateBack()
					})
				})
			},
			toTakeMoney() {
				uni.navigateTo({
					url: '/pages/take-money/take-money'
				})
			},
		},
		data() {
			return {
				money: '0.00'
			};
		}
	}
</script>

<style lang="scss" scoped>
	.wallet-container {
		background-color: #F3F3F3;
		align-items: center;
		padding-top: 108rpx;

		.take-btn {
			width: 340rpx;
			height: 72rpx;
			background: #00809F;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #FFF;
			font-size: 28rpx;
			margin-top: 406rpx;

		}

		.wallet-value {
			height: 88rpx;
			font-size: 72rpx;
			color: #1D2129;
			font-weight: bold;
			line-height: 88rpx;
		}
	}
</style>